# -*- coding: UTF-8 -*-
from datetime import *
import pytz

class DateTimeHelper(object):
    def __init__(self,zone="Asia/Shanghai"):
        self.tz = pytz.timezone(zone)
    def get_now(self):
        self.now = datetime.now(self.tz)
        return self.now
    def format_now(self,time_format):
        return self.get_now().strftime(time_format)
    def format_datetime(self,custom_datetime,time_format):
        return custom_datetime.strftime(time_format)
    def parse_by_format(self,time_str,time_format):
        return datetime.strptime(time_str, time_format)